Skip to content

Remove unnecessary Wallet::database_mut method#8

Open
evanlinjin wants to merge 6 commits intorajarshimaitra:test-helper-refactorfrom
evanlinjin:test-helper-refactor
Open

Remove unnecessary Wallet::database_mut method#8
evanlinjin wants to merge 6 commits intorajarshimaitra:test-helper-refactorfrom
evanlinjin:test-helper-refactor

Conversation

@evanlinjin
Copy link

No description provided.

rajarshimaitra and others added 6 commits August 31, 2022 18:33
 - Few test helpers and macros are scattered around `database/memory.rs` and
`wallet/mod.rs`. These are collected in a single place `testutils/helpers.rs`.

 - the `populate_test_db` macro is changed into a function. Internal logic
 should remain same.

 - A new `run_tests_with_init` macro is added in `testutils.helpers.rs`,
 which can run database tests given an initializer function.

Co-authored-by: SanthoshAnguluri <santhoshanguluri15@gmail.com>
Co-authored-by: saikishore222 <saikishore.chsk@gmail.com>
 - in `keyvalue.rs`, `memory.rs`, `sqlite.rs` use the `run_tests_with_init`
 macro to run database tests.

 - in `wallet/mod.rs` update all the test calls from macro to function for
 `populate_test_db`.

 - some import fixes in `address_validator.rs` and `psbt/mod.rs`.

Co-authored-by: SanthoshAnguluri <santhoshanguluri15@gmail.com>
Co-authored-by: saikishore222 <saikishore.chsk@gmail.com>
Similar to the database `run_test_with_init` another `make_blockchain_test`
macro is added, which will run the blockchain tests given a initilizer
function.

These test functions are taken out of the macro and are placed as their own
public functions.

A doc comment explaining how to use the tests externally from bdk is
added before the `blockchain_tests::test` module.

Co-authored-by: SanthoshAnguluri <santhoshanguluri15@gmail.com>
Co-authored-by: saikishore222 <saikishore.chsk@gmail.com>
Apply the new `make_blockchain_test` macro to run the blockchain tests
for rpc, electrum and esplora blockchain.

Co-authored-by: SanthoshAnguluri <santhoshanguluri15@gmail.com>
Co-authored-by: saikishore222 <saikishore.chsk@gmail.com>
Co-authored-by: SanthoshAnguluri <santhoshanguluri15@gmail.com>
Co-authored-by: saikishore222 <saikishore.chsk@gmail.com>
This method is only relevant for testing, so we make the
`Wallet::database` field `pub(crate)`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants